#include <iostream>
#include <set>
#include "DDVData.hh"
#include "TH1F.h"
#include "TObject.h"
//#include "DDEventManager.hh"

using namespace std;

DDVData::DDVData() {
  m_DataEventID = -1;
}

DDVData::~DDVData() {}


map<int,TH1F*> DDVData::GetCurrentTrace(void)
{
	float bincont;
//	bincont = current_trace[1]->GetBinContent(1);
//	cout << "CONT: " << bincont << endl;
	return current_trace;
}

void DDVData::define_histogram(int channel, string name1, string name2, int nbins, float lowbound, float highbound)
{
	current_trace[channel] = new TH1F(name1.c_str(), name2.c_str(), nbins, lowbound, highbound);
} 



//---All Channels---//
void DDVData::general_header::set_num_traces(unsigned int num_traces_arg)
{
    num_traces = num_traces_arg;
}
unsigned int DDVData::general_header::get_num_traces(void)
{
    return num_traces;
}
void DDVData::general_header::set_num_channels(unsigned int num_channels_arg)
{
    num_channels = num_channels_arg;
}
unsigned int DDVData::general_header::get_num_channels(void)
{
    return num_channels;
}

set<int>* DDVData::general_header::get_channels(void)
{
	return &channels;
}

//---Channel Specific---//
void DDVData::general_header::set_samples_per_trace(int channel, unsigned int samples_per_trace_arg)
{
    samples_per_trace[channel] = samples_per_trace_arg;
}
unsigned int DDVData::general_header::get_samples_per_trace(int channel)
{
    return samples_per_trace[channel];
}

void DDVData::general_header::set_bits_per_sample(int channel, unsigned int bits_per_sample_arg)
{
    bits_per_sample[channel] = bits_per_sample_arg;
}
unsigned int DDVData::general_header::get_bits_per_sample(int channel)
{
    return bits_per_sample[channel];
}

void DDVData::general_header::set_time_per_sample(int channel, double time_per_sample_arg)
{
    time_per_sample[channel] = time_per_sample_arg;
}
double DDVData::general_header::get_time_per_sample(int channel)
{
    return time_per_sample[channel];
}

void DDVData::general_header::set_trigger_offset(int channel, double trigger_offset_arg)
{
    trigger_offset[channel] = trigger_offset_arg;
}
double DDVData::general_header::get_trigger_offset(int channel)
{
    return trigger_offset[channel];
}

void DDVData::general_header::set_volts_per_sample(int channel, double volts_per_sample_arg)
{
    volts_per_sample[channel] = volts_per_sample_arg;
}
double DDVData::general_header::get_volts_per_sample(int channel)
{
    return volts_per_sample[channel];
}

void DDVData::general_header::set_voltage_offset(int channel, double voltage_offset_arg)
{
    voltage_offset[channel] = voltage_offset_arg;
}
double DDVData::general_header::get_voltage_offset(int channel)
{
    return voltage_offset[channel];
}

DDVData::general_header* DDVData::get_header(void)
{
	return header;
}

